package com.aaa.whj.service.impl;

import com.aaa.whj.dao.ISclDao;
import com.aaa.whj.entity.Scl;
import com.aaa.whj.service.ISclService;
import com.mysql.jdbc.StringUtils;
import com.util.LayPage;
import com.util.SqlSessionFactoryUtil;
import org.apache.ibatis.session.SqlSession;

import java.util.List;

public class SclServiceImpl implements ISclService {
    SqlSession session= SqlSessionFactoryUtil.getSession();
    ISclDao iSclDao= session.getMapper(ISclDao.class);

    @Override
    public List<Scl> queryAll(String page, String limit) {
        LayPage layPage = new LayPage();
        if(!StringUtils.isNullOrEmpty(page)){
            layPage.setPage(page);
        }
        if(!StringUtils.isNullOrEmpty(limit)){
            layPage.setLimit(Integer.parseInt(limit));

        }
        return this.iSclDao.queryAll(layPage);
    }

    @Override
    public long count(Scl scl) {

        return this.iSclDao.count(scl);
    }

    @Override
    public int deleteById(Integer scl_id) {
        return this.iSclDao.deleteById(scl_id);
    }

    @Override
    public int updateScl(Scl scl) {
        return this.iSclDao.updateScl(scl);
    }

    @Override
    public int addScl(Scl scl) {

        return this.iSclDao.addScl(scl);
    }

    @Override
    public List<Scl> query_scl(Scl scl) {

        return this.iSclDao.query_scl(scl);
    }
}
